<template>
	<div id="app">
		<el-container style="height: 713px;">
			<el-aside width="200px" style="background-color: rgb(238, 241, 246)">

				<el-menu :default-openeds="['1', '3']">
					<div style="width: 30px;height: 15px;margin-bottom: 90px;margin-left: 74px;margin-top: -40px;">
						<img src="../assets/menulogo.png" width="40px" height="40px" />
					</div>
					<router-link to="/default" style="text-decoration: none;">
						<el-menu-item index="1">
							<i class="el-icon-s-marketing"></i>
							<span slot="title">
								经营概况
							</span>
						</el-menu-item>
					</router-link>
					<router-link to="/d" style="text-decoration: none;">
						<el-menu-item index="2">
							<i class="el-icon-menu"></i>
							工作台
						</el-menu-item>
					</router-link>
					<router-link to="/addDrug" style="text-decoration: none;">
						<!-- <el-menu-item index="3">
							<i class="el-icon-folder-add"></i>
							新开就诊
						</el-menu-item> -->
					</router-link>
					<el-submenu index="4">
						<template slot="title">
							<i class="el-icon-location"></i>
							<span>挂号管理</span>
						</template>
						<el-menu-item-group>
							<!-- <el-menu-item index="4-1">
								<router-link to="" style="text-decoration: none;">新增挂号</router-link>
							</el-menu-item> -->
							<el-menu-item index="4-2">
								<router-link to="/registration" style="text-decoration: none;">挂号记录</router-link>
							</el-menu-item>
						</el-menu-item-group>
					</el-submenu>
					<!-- <el-menu-item index="5">
						<i class="el-icon-menu"></i>
						<router-link to="" style="text-decoration: none;">药品零售</router-link>
					</el-menu-item> -->
					<router-link to="/about" style="text-decoration: none;">
						<el-menu-item index="6">
							<i class="el-icon-menu"></i>
							收费管理
						</el-menu-item>
					</router-link>
					<router-link to="sickperson" style="text-decoration: none;">
						<el-menu-item index="7">
							<i class="el-icon-s-custom"></i>
							患者管理
						</el-menu-item>
					</router-link>
					<el-submenu index="8">
						<template slot="title">
							<i class="el-icon-location"></i>
							<span>药品管理</span>
						</template>
						<el-menu-item-group>
							<router-link to="drug" style="text-decoration: none;">
								<el-menu-item index="8-1">
									药品信息管理
								</el-menu-item>
							</router-link>
							<!-- <el-menu-item index="8-2">
								<router-link to="" style="text-decoration: none;">出库管理</router-link>
							</el-menu-item>
							<el-menu-item index="8-3">
								<router-link to="" style="text-decoration: none;">入库管理</router-link>
							</el-menu-item>
							<el-menu-item index="8-4">
								<router-link to="" style="text-decoration: none;">库存管理</router-link>
							</el-menu-item>
							<el-menu-item index="8-5">
								<router-link to="" style="text-decoration: none;">库存盘点</router-link>
							</el-menu-item>
							<el-menu-item index="8-6">
								<router-link to="" style="text-decoration: none;">药品调价</router-link>
							</el-menu-item> -->
						</el-menu-item-group>
					</el-submenu>
					<!-- <router-link to="/vip" style="text-decoration: none;">
						<el-menu-item index="9">
							<i class="el-icon-menu"></i>
							会员管理
						</el-menu-item>
					</router-link> -->
					<router-link to="vip" style="text-decoration: none;">
						<el-menu-item index="9">
							<i class="el-icon-s-custom"></i>
							会员管理
						</el-menu-item>
					</router-link>
					<!-- <el-submenu index="9">
						<template slot="title">
							<i class="el-icon-soccer"></i>
							<span>会员管理</span>
						</template>
						<el-menu-item-group>
							<router-link to="vip" style="text-decoration: none;">
								<el-menu-item index="9-1">
									会员列表
								</el-menu-item>
							</router-link>
							<router-link to="stored" style="text-decoration: none;">
								<el-menu-item index="9-2">
									储值服务
								</el-menu-item>
							</router-link>
							<router-link to="inter" style="text-decoration: none;">
								<el-menu-item index="9-3">
									积分管理
								</el-menu-item>
							</router-link>
							<router-link to="" style="text-decoration: none;">
								<el-menu-item index="9-4">
									会员设置
								</el-menu-item>
							</router-link>
						</el-menu-item-group>
					</el-submenu> -->


					<!-- <el-submenu index="10">
						<template slot="title">
							<i class="el-icon-s-data"></i>
							<span>统计报表</span>
						</template>
						<el-menu-item-group>
							<el-menu-item index="10-1">
								<router-link to="" style="text-decoration: none;">收费统计</router-link>
							</el-menu-item>
							<el-menu-item index="10-2">
								<router-link to="" style="text-decoration: none;">患者统计</router-link>
							</el-menu-item>
							<el-menu-item index="10-3">
								<router-link to="" style="text-decoration: none;">药品统计</router-link>
							</el-menu-item>
						</el-menu-item-group>
					</el-submenu> -->
					<!-- <el-submenu index="11">
						<template slot="title">
							<i class="el-icon-s-tools"></i>
							<span>系统设置</span>
						</template>
						<el-menu-item-group>
							<router-link to="" style="text-decoration: none;">
								<el-menu-item index="11-1">
									诊所信息维护
								</el-menu-item>
							</router-link>
							<el-menu-item index="11-2">
								<router-link to="" style="text-decoration: none;">字典表维护</router-link>
							</el-menu-item>
							<el-menu-item index="11-3">
								<router-link to="" style="text-decoration: none;">员工管理</router-link>
							</el-menu-item>
							<el-menu-item index="11-4">
								<router-link to="" style="text-decoration: none;">检查项目设置</router-link>
							</el-menu-item>
							<el-menu-item index="11-5">
								<router-link to="" style="text-decoration: none;">供应商管理</router-link>
							</el-menu-item>
							<el-menu-item index="11-6">
								<router-link to="" style="text-decoration: none;">模板维护</router-link>
							</el-menu-item>
							<el-menu-item index="11-7">
								<router-link to="" style="text-decoration: none;">费用设置</router-link>
							</el-menu-item>
							<el-menu-item index="11-8">
								<router-link to="" style="text-decoration: none;">基础设置</router-link>
							</el-menu-item>
						</el-menu-item-group>
					</el-submenu> -->
				</el-menu>
			</el-aside>
			<el-container>
				<el-header style="text-align: right; font-size: 12px">
					<el-dropdown>
						<i class="el-icon-setting" style="margin-right: 15px"></i>
						<el-dropdown-menu slot="dropdown">
							<el-dropdown-item>
								<el-link type="primary" :underline="false">查看</el-link>
							</el-dropdown-item>
							<el-dropdown-item>
								<el-link type="info" :underline="false">新增</el-link>
							</el-dropdown-item>
							<el-dropdown-item @click.native="logout">
								<el-link type="danger" :underline="false">注销</el-link>
							</el-dropdown-item>
						</el-dropdown-menu>
					</el-dropdown>
					<span>{{user}}</span>
				</el-header>
				<el-main>
					<router-view></router-view>
				</el-main>
			</el-container>
		</el-container>
	</div>
</template>
<script>
	export default {
		data() {
			return {
				user: ''
			};
		},
		created() {
			this.initUserName();
		},
		methods: {
			logout() {
				this.axios({
					method: "get",
					url: "http://localhost:9999/auth/admin/token/logout",
					params: {
						access_token: localStorage.getItem("access_token")
					}
				}).then(res => {
					console.log("注销返回信息:{}", res);
					if (res.status == 200) {
						alert('注销成功');
						this.$router.replace({
							path: "/"
						});
					}
				})
			},
			initUserName() {
				this.user = localStorage.getItem("user");
			}
		}
	};
</script>

<style>
	.el-header,
	.el-footer {
		background-color: #B3C0D1;
		color: #333;
		text-align: center;
		line-height: 60px;
	}

	.el-aside {
		background-color: #D3DCE6;
		color: #333;
		text-align: center;
		line-height: 200px;
	}

	.el-main {
		/* background-color: #E9EEF3; */
		background-color: white;
		color: #333;
		text-align: center;
		line-height: -10000px;
	}

	body>.el-container {
		margin-bottom: 40px;
	}

	.el-container:nth-child(5) .el-aside,
	.el-container:nth-child(6) .el-aside {
		line-height: 260px;
	}

	.el-container:nth-child(7) .el-aside {
		line-height: 320px;
	}
</style>
